Fixes #13429. (cherry picked from commits b5f110c77e, 6b3f013a82, and e016859c3b)
b5f110c77e
6b3f013a82
e016859c3b