improve a little bit the performances of save_tree + create a first unit test for save_tree