Fix permissions checks.
Merge pull request #4 from AgentME/permsfix

Fix permissions checks