modified script to run each fold separately