fix a bug in computing probabilities