fix a bug when image is out of screen