move tests to top
fix nans at clopper-pearson limits