added try/except for template error