Fix error when uploading image