Fix bugs in the calculation of the observed variables.