catfile -> catdir when necessary