I think you simply confused this:

a) Data[i][j] // Beware of the major!

with this:

b) Data[n*i+j] // no major here...

Am I right?