Fix energy calculation.