Merge pull request #284 from LipuFei/improve-statistics

Improve statistics
some fixes for statistics
fix statistics enable_debug()