Fixed the window resizing issue in a non-hack way