fix bug in cookie