bug in writing csv --