Fixes #4926
Merge pull request #5815 in master
Merge pull request #5831
Merge pull request #5831 in develop