trying to fix the upload logic