kNearestNeighbor bug fixes