Fixes #5893
Fixes #5881
Merge pull request #5895 from mwerezak/fixes

Fixes