What if `totalCnt == 1`? R's `var` returns `NA` for a sample of size 1.