fixed global variable not being used with unsafeWindow