fix #26 and add test case