write to file before the dir is created... doh!!