Fix gamepad breaking and scene closing issue.