improved by modify the empty count. log the record