fixing a bug in update