fixed cookie handling