Fixed window resize bug