Completed fix for template rendering