fixed the file writing