Check dimensions to avoid division by zero due to invalid new dimensions.