Bug fix in save_tree