fixed preorder iterator, and tested cases in cases.txt