Fix unregistering issue by registering in onResume