adding residuals and coef of det