fix bug in Bayes functions