fix infinite loop

for expression 
```shell
"1+2+3+4"
```
(expression ends with a digit).

check_values will cause infinite loop, this patch fix it.