Cherry-picked b9a53662fad1e37faa2a415db4d17b1d0e5c6b40