csv_write call in wrong method