fix a bug in the mcmc sampling code.