fixed a bug not finding k for kmeans