template rendering related fixes