Add some error checks to `run`.
Add error checking to `p`.