Fix principal.c issues

An XXX left, there's a leak.
WIP