Fix sorting for first element