fixed clustering script