patches to clustering helper functions