Fixed a bug which would lead to inconsistent graphs