Use window. on certain function calls.

This is an attempt to resolve #609 - however, I was not able to reproduce locally.

@coderoshi - how do you suggest I build the site to reproduce the error in that issue? Thanks.