better window resize handling