json_serializer and csv_serializer changed to internally hold pointers to output stream