I must have been really tired when I wrote #4846

Fixes #5515
Fixes #5517