Fix backwards incompatibility for Content-type header and fix bugs