fixed a few bugs in centroid_variance.R