Update TemplateUtilsTestCase
Fix more bugs in the template parser/write code