add test case and fix