error checking in co_tree_next