Fixes to register_listener