r2.sh: misc fixes