renamed _cache and _count to tmp