several fixes to linearRegression