fix logging bugs and support content-type