Various fixes to get windows builds working.