removed bug in csv writing
error