Bug fix for knn: the labels were not assigned correctly.