fix a few bugs in GridModel