Fixed energy leaking issues.