bugfix when writing file in not binary string platform