Fixes #1785

Makes sure that expressions depending on identifiers that might
get overwritten only see the incoming execution context
Merge pull request #1814 from systay/1785

Fixes #1785