fixed a bug with image uploading