replace tree-subst with map and subst support for trees