fix permission queries (grant/revoke/list-perm)