fix bug for writen