Tested and fixed bugs for bayesian update.