Yes, you are right. I made logic mistake. I should loop column number first, then loop row number inside it. My testing data happens to be a square matrix, same columns and row numbers, which hides the logic error.
After correcting it, all CSV files are processed correctly.
Cheers,