writed update function