derivation attribute.
* Fix GC and substitute bugs related to self-references. Add a regression test.