Fix bad z position of generated edges