implement upload logic
fix some bugs