Added check for template file