Fixed #215: Error when duplicating products with images
- restructured changes for simplicity