fix pap arity and some rts issues