Added a null check in getCookie that caused problems with some browsers