unify nested structures correctly