fix bug: memory leak on windows