fixed a bug in energy calculations where old energy was not being stored