Followup to #507

This is a commit that was supposed to be part of my fix for #507, but I forgot to push it before merging the original PR *sigh*.