make resample_simple more robust