Fix of bug in sampling.