With your error checking the way it is, `$d` can be `undef` here.