fixed small bug in cookie handling