Better handling of permissions errors

@kehribar Addresses #22