Improved compression speed

and modified one line into writeHeader (issue 19)