Amended serialization to not add BOM to the output stream.