Change the way to write binary from input to output