Graph.merge: fix scoping issue