Fixed bug when adding edges.