A few bug fixes for v6. See commits for details
Fixes #7130 (closed) Fixes #7131 (closed) Fixes #6697 (closed)