Fixed bug for jpeg and multiple canvases combined