Fixed multi-branch tree traversal