Fixes to Metropolis-Hastings algorithm