Added counter decrement when removing entities.