correctly set destination file mode to binary to prevent encoding errors
ruby 2.1.1