Better circular dependency detection