Fixed a few issues with types, and compiling with mingw.