Add fix from #16413
Merge pull request #18651 from basepi/issue-16413

Add fix from #16413