solve edge orientation problem