Fix some small bugs in the fitting. Still convergence issues