fixed small error in image saving