Lost-in-merge fix, again.
Fix for #3535.
Merge pull request #3536 from Segrain/master

Bugfixes.