Fixed bug on deleting of edges: in some cases the edges were removed by vertices but continue to stay in db