fix #1664, fix #1733