Fixed file stat check in an empty directory. Error is reported through DEBUG and SystemMessage.