write gaia stackstack's test case and fix some bugs.