Fix sorting issue