fix check for existing dirs