Misc changes to keypress handling