fix bits shift
fix the test, and add rountrip test for GroupStats