Fixed small bug with checking active window