Backport 3678

Backport #3678 to fix test failures for 64 bit compiles on 64 bit windows.