some bug fixes and a rudimentary cross validation script