Fix: verify for existance of 'window' to be able tu run in web workers.