portability fixes

ftw is not available for mingw32, thus it cannot be used like on linux and
mac. Also removed unused pthread header includes.