bugfixes, distributions, and more stats functions