Nathan prevent var shadowing

This is a merge of https://github.com/LLK/scratch-flash/pull/260

Fixes #119.
Fixes #349.
Fixes #374.