updated cookie handling