Fixed memory leaks on do_batch_monte.