fix mysterious bugs so paper builds

also, work around p-value script not working anymore