optimize cookie checked