Hi,
I guess it has something to do with inproperly destroyed objects (as you said, the first time the data is correct).
Before creating the new grid, you should use both my_grid->free( ) and FREE my_grid, so that there is no reference to the old grid left.
hth