write gaia test case and fix some gaia bugs.