Handle empty directory correctly.