Fix reference counting for blocks.