Found problem with linear fit.

sorted it now. It's still not behaving 100% right but it should be easy
to get it right now.