bug fix for calculating probabilities