Fix false positive detection of circular references