Fixed stack overflow from old readdir code