Fixed some global variables not being used with unsafeWindow