Fix circular reference detection.