Ensure correct scoping in generated JS. Fixes #15.