fix window resize bug