fix bugs in ExactInference
Merge pull request #2381 from yorkerlin/develop

fixed bugs in ExactInference