Fixed issue with undefined _window variable