Fixed csv logging bug