the unreg needs to happen before the is_primary() return value changes, or else it won't unreg when it goes from primary -> !primary