Reorganize pkg_add slightly.
Fix upgrade.
Forgot to add.
Add missing includes.