apply #2350 to master/3.x too