add test for write csv