fixed cookie handling
several type fixes