Correcting the forward-porting of #365

as it was (whoopsie!) lost in a rebase.