Fixing checkPermissions method