Fixed except/endexcept in template.