fixed saving bug where source image could be overwrote