Fix possible energy loss bug