Fix for #6476.
Fix for #6643.
Fix for #7322.