factored out counts for debugging; still has bad access