fixed issue with calculating widths of images and canvas