fix check for the existence of cookie before deleting