Remove fprintf
Add some error messages to tree_writer
more wip