Building on what oshalla said, you get yourself into trouble with your split unless something about your data precludes the presence of commas within quotes. If there is a quoted comma, you will end up with more fields than you expected.
Also, in debugging a problem like this, it is extremely helpful to compare your debugging output to the input data.