Enhance the update function.

Run npm test to avoid the regression