file is written properly now