Fixed cursor going outside of the screen.