cleanup of refineRegister