fixed undefined gridX bug