fix reading files under the root tern director more than once