Fix for #6649.
Fix for #7330.
Fix for #7324.
Merge pull request #7332 from Segrain/master

Bugfixes.