fixing a bug when update data