Fixed some issues with window resizing