Permission check

Fixing #4