Replaced check "window || this" with "this"