cookie function fixed.