fix KMedodid clustering bugs