adding custom error trap, instead of just set -e