Improved chunk serialization