improve error reporting for bad templates
add existence func and unit test
fix update.sh
Merge pull request #3141 from lavalamp/optimize

Fix e2e; add template function to make this possible