changes grid if width and height are not equal