Fix some issues with callbacks and events.