fixed bug in energy calculation