fixed bug of document count not updating.