Fix for #55

Fixes the error
```
Error: Permission denied to access property 'type'
```

discussed in issue #55
Merge pull request #56 from xOneca/patch-1

Fix for #55