Patch debug handle_keys()