Fix empty path bug and resize the window.