Detect circular references and croak
Don't use defined-or, to make it work on 5.8