fixed a bug where edges would be duplicated