Fix bad behaviour when there are no subdirectories.