Fix bug in gradient computation.
Actually burn-in, rather that optimize.