fix build failure and panic on Windows.