WTF was wrong with me when I rewrote tree_getNextNode()?