fix replaceCanvasWithImage