various win32/C99 fixes