detect circular dependencies