Fix bug in typeFit