Minor changes to make the text file writing work on pc and mac