fix #1761 and #1648