fix problem with template parsing