fix the upload function