finish readi and writei