BUG: correctly tokenize local variable references

Forgot to actually do this in #6366 even though I put a release notes entry in