fixed bugs in ExactInference