fixed bug in cross validation