added case to check if subdirectories object is empty