fix the saving of images