Correct dimension check of coefficients