fixed final energy error