Fix problem with saving the image