Modified local.sh to handle error