fix some bugs in countNums