Fixes to binary tree traversal