solve problems with window resize