Added missing endif to template