Rewrote gradient computation in LazyMaxLikelihoodMPE.