window resize working (with some bugs)