Fixed statistics calculation to address issue #21