Fix some missing retain/release stuff.
Fix some memory management bugs