Adds correct error handling for missing templates.