Fixed bugs in csv log output