fixed some issues with clustering algorithms