Add check for directories