Created by: lukaszzdanikowski
This fixes error window is undefined on env where the window is not available.
window is undefined