R: added some nasty workarounds for functions that create a lot of graphs, so far decompose.graph uses it. Fixes issue #508.