Fix sorting of kNN results.