fix #163 and fix #161