update UpdateTemplate script to respect build flag