Fixes #6002
Merge pull request #6004 from mwerezak/fixes

Fixes #6002