Clustering bugfixes