fixed the add edge functionality