Cygwin workarounds

Added some workarounds to allow use under Cygwin.