fix up window resize logic