wrong usage of 'unless' for nil check

Sometimes this was causing a
```
undefined method `empty?' for nil:NilClass
```