Fixed lots of bugs in generic.cv and generic.bagging