corrected window resize handling