Fixing bug in image copy