fixed some bug and add the daily stats

fix testcases by adding asserts