Fix some, but not all, of the bugs that prevent a windows build.