totally revise new circularity checking for much better error messages