proper handling of cookie.