Resizing the window no longer crashes the app