Typing error in RTC solved. Bug in unregister function solved. Unregistering on exit.