Fixes for general expectation computation.