Fix possible windows crash