fixing bug looking for non-existant directories