Fixed x and y var setting in createGrid