Fix AttributeError in prediction.