switched to binary file mode for windows compat