Backport of #10144 to stable7

Backport of #10144 to stable7