fix bayesian and add tests