Bayes factor calculation using a numerically stable formula: Seems to be working OK now