check if same number of grid cells in error function