fixed bug with overlapping edges