[Decaf] PP3/4: fix bugs and add error checking according to the pp3 test cases.