Cells return data no present in the grid

Dear all,
I insert data in a Grid example
A
B
C
D
E
using mygrid.cellByIndex(5,0).getValue() or mygrid.cell2(5,0).getValue() I received as answer 5, but I received the same answer also with
mygrid.cellByIndex(4,0).getValue() or mygrid.cellByIndex(4,0).getValue();
the grid “duplicate” the last row … please can you help me asap?
Thanks
Cristina

Row indexed in grid is zero-based. First row index is 0, last row index is 4

I know! The problem is the the last row has index 4 but also the row with index 5 (that not exists) return value!