change a bit of fit.R