fixed clustering bugs