Improved handling of Content-Type header. Possibly not needed.