fixed some bugs in the gibbs sampler, including a major bug