Calculate createGrid correctly.
Calculate createGrid correctly.