Fix problem where the window check didn't work