fix unordered graphs issue #158