some tweaking of fit functions