fix Too many directories bug