add stat func, fix test error