Fix overflow

Fix a numerical overflow bug in the posterior probabilities