Fix Windows build and tests