update way of checking empty directory
Merge pull request #949 from afc163/master

update way of checking empty directory