added stratified resampling, but the cum_sum needs to be fixed