fix a bug in monte_carlo