fix #21663
Merge pull request #389 from lvinken/osx-fixes

fix #21663