Bug fixes in Monte Carlo functionality