Make sure to compute nDims2 everywhere