Fixes a few bugs in the tree_test - this test now works