fix check for permissions (regression from #37)