Add circular dependency detection.