Fix varname in update function