Fixed indexes error in coefficients computation.