Fixing a bug: wrong CGs were reset when recursing into a sub-graph.