Handle exceptions on handlers
Make `register_hotkey` more robust