Minor bugfixes, also compute pvalue and its uncertainty