window resize bug fix