write gaia tree test case and fix some bugs.