fixed overlay flip and added original image storage functionality