fix #13, partially fix #12