table names in templates, correct error checking in EXEC