added "set -euvx" to enable debug mode.