fixed algorithm for verifying an empty directory