Fixed for 24 and cygwin.

Thanks @MatthewDarling
merged