fix remote_upload and fix some bugs