Fix window ID detection