Fixed HW statistic overflow at large sample numbers.

 - added tests. resolves issue #44