added set -o {nounset,errexit}