works for tree merge