Fix JavaScript scoping, since pipeline puts all JavaScript inside a closure