added lock to update method