Some fixes for zero copy serialization