fixed removal of PHP closing tags for templates