Rename binmode into textmode and use it correctly