Sort bug introduced and fixed