add read/write furction to serializer