Improve directory perms checks in plugin

Needs testing before building new package