FIxed cookie function.