fix #8473

Backport of 3f4675ea1f5989ddf36ebaba586b99429211aee2
Ref: #8477