debug log enhancement
allocate saved_count on heap