check for model!= null before prediction