fixing write/read output stat file