properly detect `while(true)`
make sure `var_values` is reset even if we raise exceptions
add some debug checks and fix tests
pass more positions around