updating tempfile to use binmode