fixed a crash when user pressed near to the right edge of the screen