fixed bug with window resize