Fix window resize behavior