added template rendering checks