Fix bug in update graph