gzip feature and minor fixes

rewrited