Correctly handle empty folders.