better handling of setVal(undefined)