Fix case where top is not in TreeNode path, such as root