fix #12, fix #24