Correction of history stats counter after restart?

Hi Community!
I have defined a history_stats counter that shows how many times the washing machine was running today (state: “On”). But when I restart Home Assistant while the washing machine is running, this counter is incremented by 1 each time. Is it possible to correct this somehow?

Thanks for any advice!
Best regards
Rado