Backport d2b5db53b9d621b5078edbe0f909b2f14916bc31 to 4.8.0