some tweaks of kmeans