Unexpected side effect behavior using VAL() (SOLVED)