fix bug when document.cookie is empty