Some more error handling in stochastic generation.