Fixed issues with template rendering