Various fixes to keyboard input on windows