fix reading directories