Backport PR #4024 to 1.8

Backport fix for gh-4024 to 1.8