Fun with ByteBuf reference counting.

Fix ByteBuf reference counting that was breaking the shared serialization.