bugfix in sum product logZ calculation