Fix UT failures in test_kstate and test_stats_mock