fix entity counting