fix cluster function