repair some bugs and add a upload function