work in progress trying to resolve the bugs for the case in which multiple trials are run