simplify tree.write