rewritting binary file