event on startwrite and endwrite