predict and fit methods, plus some fixes