add defensiveness to template