Fix Mouse and Keyboard input handling