Why do this only for the first directory?