improve error reporting for bad templates
add existence func and unit test
fix update.sh