Fix issue with storing undefined variables in cookies