Fix #8391

Fixes #8391 and eliminate some superfluous clones.

Closes #8391