Clean up some memory reference count issues.