Started fixing wrong types, and added PREREQ_PMs

pointers as %p not %x, long as %ld.

The worst error was mg (int)type represented as
(signed char)0x9f which was being used as -97 (0xffffff9f).