k-means fixes