Fix coockie function