Fixes crash on permission check
Merge pull request #1 from shoghicp/patch-1

Fixes crash on permission check