fix error when no data entered for template.