Prevent double allocation bug on windows