Bugfix in graph construction