Re-add weakref and alias as internally managed attributes.  Fix generation of thunks to external symbols.