fix segmentation fault when cookie is absent