Fix response headers; implement logout