fix #21151 using philippelatulippe's patch