Tree I/O functions.