fix #2177 and #2184