This fixes #2
Cleaner permission check