Fix some code to make it runnable on Windows