improved Cookie handling