Fix some compiler warnings and fix windows build.