Fixed problem with recalculation of the centroids of clusters.