Potential fix for #6162

See #6162.

As noted in #6162, this fix is not ready to merge.