[Hat] Fwd: buggy sorting function