Fixed bugs in predict