- fixed gzip handling and write correct header