fixed a lot of bugs. bug in build() probabiliy is next to fix: every node has GATE as parent