Catch a few error cases gracefully and tweak shell scripts.