Msg unread counter does not work sometimes

A bit more details? Sometimes when? Which unread counters? All?

I am using Mi A1 with Android oreo, message app version is 2.9.052. The only time it worked was when there were a few messages after factory reset, but after restoring the messages it no longer works and is stuck on a reading of 30. ( Btw this is not related afaik to restoration of messages as I had the issue previously as well) unread counter of Gmail works perfectly, I haven't tried any other.