fixed bug with going out of the screen