port to win32

Really fast and brutal fix to some win32 issues