Fixed results writing file