Protect in case window is not defined.