Fixes #6118
Merge pull request #6175 from mwerezak/master-fixes

Fixes #6118