Fixed bug in stochastic generation.