Fixed resizing window bug