Better handling for exit events.