add upload.sh
Fix more a+ portability bugs