adjust do_sampling and fixed a bug.