Permissions bug fix