fixed the bug in cross validation in the code