Fix readdir function.