add more tests to avoid null gui bugs
rework the self-intersecting code (still some bugs, tought)