Added a option to serialize with chunks.