fix headers, add logging