fixed predict_fn