Fixed issue with registering event callbacks