Fixes to clustering