- Changed check permission function.