added some first MinGW compatibility code