Fixed cookie handling which previously could not cope with missing session id when the cookie was present.