From Stephan Huber, fixed for Windows 64bit build