Added binary flag to fopen.