check if window is not undefined