fix #3972, fix #3965