fix #1143 and #1145  also 2_7_1_pre3