fixup! split dir eof stuff into another function