Fix a heap issue with static on Windows