Candidate fix for some refcounted-resource leaks