Fix ReferenceErrors since we can't qualify with `window`

btw, this is the worst language. Fixes #287