Improve circular reference logic in equiv - Fixes #397