permissions bug fixes