wrong arguments in fwrite fixed