fixed readdir() usages