Small adjustment to the write_to_file functions in string helper