fix test
extend error, writer, reader to state