Fixed bug for templates not rendering properly