better cookie handling