fixing a resizing window bug