Fix and simplify flag_counts schema