Fixed crashes on Windows