fixed ofstream function to write to binary file