Fixed overflow
Merge pull request #1631 from davebaol/wmean

Fixed overflow