mingw compilation fixes, patch by Daniel Atallah.