adding totalAffected to csv output