Changed the way of setting the canvas size