Fixing permissions bugs