Bug fixes

To do: line 91 fixing update in counting when no edge exists yet.