Fixes and tests for preorder iteration