Fixes problem with missing closing tags on template