fixed_writetofile