adapted code to match current dirent version / remove some warnings with c++11