small tweak in update function