Fixed bug in rejection sampling.