Fix bug in equilibrium calculation