Fix reference counting.