Fix crossing edges
Improves dynamic mask search