fix circular references for NSAs, still doesn't work for other types