Fix clustering bugs