fixed issues with data manipulation in cross validation