fix new window/tab crash