Fix sorting method