Fix the permission check