Some fixes. Should work under cygwin now, I think.