Fixes for TemplateNode bugs with primitive and dataset replacements.