some tests and fixes for statistical functions