dded statistics, fixed some bugs