fix some bugs through the test