fixing the broken readdir_r with stack dirent, too