handling circular references