Fixed ref-counting assertions