Fix problems with parallel_for, modified resampling_bootstrap