minor bug fix for monte carlo function