Fix a bug with image uploading