Tweaked image copy code