backport 7518acb1379bec986f21ff3e059f4847aa60216b