fix range bug in KMeans