Fixed bug in templating engine