Fixing the edge relationships