Fix window recursion problem