makes template_key optional for dump_tree