Fixed  bug with updating elements