fix some upload logic