kmeans: small optimization