fix windows panic bugs