works with circular references