Fixed bug with image cut near boundaries of canvas