You need to make sure `$?` exists before calling methods on it, apparently.