Fixed infinite energy bug