Fixed bug in csv-parsing function