permission bug fixes