modify a bug in pick_sample