Fixes for windows (mingw32) compilation