Fixed bug due to changing from for to foreach loop to run cross-validations.