fixed a bug in update operation