Fix for #55

Fixes the error
```
Error: Permission denied to access property 'type'
```

discussed in issue #55