bug fixes to permissions