make update() operation atomic