Fixed pointer issue in template render