fix some compile error for cygwin and mingw