update cookie function