Fix the count segfaults