check for circular references -- closes #24