update with error passing var as function argument