MAINT|BUG: Some small refcounting fixes