Fix sorting error