working CSV write