as commented above, this is to make sure when there's no instances registered, the pkgmgr_handle_ should not be set too.
Maybe assert() is better here, how do you think?