Fix setCookie function