Fix the first seg fault, and some startup bugs.

Still plenty of problems left to fix.