Fixes to how empty documents are counted.