detect more cases of empty directories and actual errors