Fixing pval functions