#4 fixed cookie handling