fix #8137
fix #9206 and partially fix #7910