restore read_dir functions