added trailer serialization