port to windows and fix keypress errors