handle nonexistent templates and errors