writing state