Fixed the issue with wrong total docs