Fixed issue with probability algorithm and updated tests to cover the issue