corrected some bugs in global k-means