fix bug in update