Correctly handle circular dependencies