fix debug of val not defined