Bug fixes + weak-ref test.