Update cookie saving function