add test case, fix bugs