Fix some edge cases

cc @sh1mmer @Matt-Esch
```javascript
if (err && (!err.code || err.code === 'ENOENT')) {
```

?