fixing problems with window resize