make sure flag counts update correctly