Passes test-p-bad cases

TODO: correct two errors in test-p-ok