Fix bug with gdt cursor and null strings
Fix error in function to write csv files