Fix a bug of making a duplicate key in reset() and update().