fixed the issue with only writing once to the file