fixed bug when cookies is cleared you get an error