fix file_io for Mac OS X