Avoid error document.cookie = null

Usual browsers return null in that case.