Fixed issue with image uploading and saving